package com.demo.order.controller.api;

import cn.hutool.core.lang.UUID;
import com.demo.common.core.response.Response;
import com.demo.order.request.CreateOrderRequest;
import com.demo.order.response.CreateOrderResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 订单控制器
 * 处理订单相关的API请求
 */
@RestController
@RequestMapping("/api/order")
public class OrderController {

    /**
     * 创建订单
     * @param request 创建订单请求
     * @return 订单创建结果
     */
    @PostMapping(value = "/create")
    public Response<CreateOrderResponse> create(@RequestBody @Validated CreateOrderRequest request) {
        CreateOrderResponse createOrderResponse = new CreateOrderResponse();
        createOrderResponse.setOrderId(UUID.fastUUID().toString());
        createOrderResponse.setStatus("CREATED");
        createOrderResponse.setMessage("订单创建成功");
        return Response.ok(createOrderResponse);
    }
}
